package com.nantong.common.core.enums.commonEnums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 客户等级枚举
 *
 * @author nantong
 */
@Getter
@AllArgsConstructor
public enum CustomerLevelEnum {
    A(1, "A级"),
    B(2, "B级"),
    C(3, "C级");

    @JsonValue
    private final Integer code;
    private final String desc;

    public static CustomerLevelEnum fromCode(Integer code) {
        for (CustomerLevelEnum value : CustomerLevelEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}